package concurrent

import (
	"fmt"
	"sync/atomic"
)

// 测试 atomic

var count int32 = 100

func add2() {
	atomic.AddInt32(&count, 10)
}

func sub2() {
	atomic.AddInt32(&count, -10)
}

func main_() {

	for i := 0; i < 10; i++ {
		add2()
		sub2()
	}

	fmt.Printf("count: %v\n", count)
}
